package game.strategy;

import game.Constants;
import game.player.Player;

/**
 * @author celebi
 *
 */
/**
 * @author celebi
 *
 */
public class StrategyTESTER implements Strategy {
	
	// Agent that the strategy is binded 
/*	private Player BindedAgent;

	public StrategyTESTER(Player anAgent) {
		bind(anAgent);
	}
	
	public boolean bind(Player anAgent){
		if(BindedAgent == null){
			BindedAgent = anAgent;
			return true;
		}else{
			return false;
		}
	}*/
	
	public int play(int OpponentPreviousChoice, int RoundNumber) {
		boolean isRetaliated = false;

		int whatIplayed = Strategy.NONE;

		if (RoundNumber == 0)
			whatIplayed = Strategy.DEFECT;

		if (RoundNumber > 0) {

			if (RoundNumber == 1) {
				if (OpponentPreviousChoice == Strategy.DEFECT)
					isRetaliated = true;
				else
					isRetaliated = false;
			} else {
				if (isRetaliated)
					whatIplayed = OpponentPreviousChoice == Strategy.COOPERATE ? Strategy.COOPERATE
							: Strategy.DEFECT;
				else {
					whatIplayed =  RoundNumber % 3 == 1 ? Strategy.DEFECT : Strategy.COOPERATE;
				}
			}
		}
		return whatIplayed;

	}
}
